package corp.edu.amadeus.core.bluetooth.sender.impl;

import corp.edu.amadeus.core.bluetooth.sender.ifc.ISender;
import javax.microedition.io.Connector;
import javax.microedition.io.StreamConnection;
import javax.microedition.io.StreamConnectionNotifier;
import javax.bluetooth.DataElement;
import java.io.OutputStream;
import java.io.InputStream;

public class SPPSender implements ISender {

	public void send(String url,  byte[] content,
			String contentType, String contentName) throws Exception {
		// TODO Auto-generated method stub
		//url = "btspp://001C9A757BB1:9;authenticate=false;encrypt=false;master=false";
		StreamConnection conn =
			   (StreamConnection)Connector.open(url);
		OutputStream os = null;
		os = conn.openOutputStream();
		byte buffer[] = new byte[100];
		//InputStream is = conn.openInputStream();
		String prueba = "Texto de prueba";
		os.write(prueba.getBytes());
		//is.read(buffer);
		//is.close();
		System.out.println("Texto enviado y respuesta recibida: ");
		os.flush();
		os.close();
		conn.close();
	}

}